﻿using System.Threading;

namespace CLVisionIOCardNC620.IOCardDevice
{
    public interface IIOCardDevice
    {
         int nCurCardID { set; get; }
        string SerialNumber { set; get; }
        string TypeName { set; get; }
        bool IsOpen { set; get; }


        int IOCardBits { get; }
        int IOCardInputBits {  get; }
        int IOCardOutputBits { get; }

        //多开的互斥量
        Mutex Mutex { set; get; }
      //  string DisplayName { set; get; }

        void Release(int CardID, out int ErrorCode, out string ErrorText);

        bool CloseIODevice(int CardID, out int ErrorCode, out string ErrorText);
        bool GetInPutData(int CardID, out long InPutData, out int ErrorCode, out string ErrorText);
        bool GetOutPutData(int CardID, out long OutPutData, out int ErrorCode, out string ErrorText);

        // Binary二进制倒序
        string InvertBinaryString(string binary, out int ErrorCode, out string ErrorText);
        bool OpenIODevice(int CardID, out int ErrorCode, out string ErrorText);
        bool ReadInPutbit(int CardID, int PortBit, out int Value, out int ErrorCode, out string ErrorText);
        bool ReadOutPutBit(int CardID, int PortBit, out int Value, out int ErrorCode, out string ErrorText);

        // Binary二进制按位取反
        string ReverseBinaryString(string binary, out int ErrorCode, out string ErrorText);
        bool SetOutPutData(int CardID, long OutPutData, out int ErrorCode, out string ErrorText);
    
        bool WriteOutPutBit(int CardID, int PortBit, int Value, out int ErrorCode, out string ErrorText);

       bool GetCardVersion(int CardID, ref long VerNumber, out int ErrorCode, out string ErrorText);

        void InterruptFun();

        bool SetInterruptEnable(int CardID, int Enable, out int ErrorCode, out string ErrorText);
    }
}